<?php
require_once('../../core.inc.php');
require_once('Model/SiteManage.php');
require_once('Model/DB.php');
require_once('Plugin/Category.php');

$sys = new Model_SiteManage();
$sys->checkLogin();
$params = $_REQUEST;
$category  = new Model_Category();

$id = htmlspecialchars( $params['id'] );
if( !is_numeric($id) ) exit;

$list = $category->getList(array("id" => $id));

$body = "";
foreach( $list as $row ){
	$body .= "{ id: '" . $row['id'] . "', name: '" . $row['category_name'] . "' },";
}
$body = substr( $body, 0, strlen( $body ) -1 );

header('Content-Type: text/plain; charset=UTF-8;');
print "{[";
print $body;
print "]}";
?>